<style scoped>
.time{
    font-size: 14px;font-weight: bold;width: 177px;
    display: inline-block;position: absolute;line-height: 14px;
    left: -180px;
}
.p1{font-size:14px;padding-bottom:10px;text-align: center;border-bottom: 1px #ddd dashed;
margin-bottom: 20px;}
.content{display: inline-block;padding-right: 10px;}
.ri{text-indent: 30px;font-weight: normal;}
</style>
<template>
<div>
     <Modal v-model="modal" :title="title" :styles="{width:'600px',top:'20px'}">
        <p class="p1">物流公司： {{company}} &nbsp;&nbsp;运单号码： {{id}} &nbsp;&nbsp; 状态：{{status | decode('express_state')}}</p>
        <Timeline style="padding-left:200px;max-height:500px;overflow-y:auto;">
            <TimelineItem v-for="(item,index) in progress" :key="index" :color="index==0?'blue':'green'">
                <p class="time" :class="{ri:item.time.indexOf(':')>0}">{{item.time}}</p>
                <p class="content">{{item.context}}</p>
            </TimelineItem> 
        </Timeline>
         <div slot="footer">
             <Button @click="cancel()">关闭</Button>
         </div>
     </Modal>
</div>
</template>
<script>
 export default {
     data (){
         return {
             modal:false,title:'快递跟踪',status:'',
             id:'',company:'',
             express:[],
             progress:[
               
             ]
         }
     },methods:{
         showdata(params){
            this.id=params.express_number;
            this.express=this.$store.state.global.express;
            //this.company=params.express_company;
            // this.express.forEach((item)=>{
            //     if(item.expressCode==params.express_company){
            //         this.company=item.expressCompany
            //     }
            // })
            this.axios.post('/invoice/express/detail',
                {expressCompany:params.express_company,expressNumber:params.express_number}).then((res)=>{
                console.log(res);
                this.company=res.data.expressCompany
                this.progress=res.data.expressMessage.data;
                this.status=res.data.expressMessage.status;
                this.modal=true;
            })
            
         },
         cancel(){
             this.modal=false;
         },
     },created(){
         //this.$bus.on('bus_progressedit', this.showdata);
         this.$parent.$on('bus_progressedit', this.showdata);
     },beforeDestroy(){
         this.$parent.$off('bus_progressedit',this.showdata)
     }
 }
</script>
